package com.cenntro.common.util;

import org.apache.commons.lang3.math.NumberUtils;

public class NumUtil extends NumberUtils{

	
	public static int toInt(Object obj, Integer ... defaultVal){
		if(obj == null){
			return 0;
		}
		return NumberUtils.toInt(obj.toString());
	}
	
	public static long toLong(Object obj, Long ... defaultVal){
		if(obj == null){
			return 0l;
		}
		return NumberUtils.toLong(obj.toString());
	}
	
	public static double toDouble(Object obj, Double ... defaultVal){
		if(obj == null){
			return 0d;
		}
		return NumberUtils.toDouble(obj.toString());
	}
	
	public static double toFloat(Object obj, Float ... defaultVal){
		if(obj == null){
			return 0d;
		}
		return NumberUtils.toFloat(obj.toString());
	}
	
	
}
